document.addEventListener( "plusready",  function()
{
    var _BARCODE = 'esptouch',
		B = window.plus.bridge;
    var esptouch = 
    {
    	getWifi : function (successCallback, errorCallback ) 
		{
			var success = typeof successCallback !== 'function' ? null : function(args) 
			{
				successCallback(args);
			},
			fail = typeof errorCallback !== 'function' ? null : function(code) 
			{
				errorCallback(code);
			};
			callbackID = B.callbackId(success, fail);

			return B.exec(_BARCODE, "getWifi", [callbackID]);
		},
		setTerminalWifi : function (ssid, wifipassword, taskcount,successCallback, errorCallback)
		{
			var success = typeof successCallback !== 'function' ? null : function(args)
			{
				successCallback(args);
			},
			fail = typeof errorCallback !== 'function' ? null : function(code)
			{
				errorCallback(code);
			};
			callbackID = B.callbackId(success, fail);

			return B.exec(_BARCODE, "setTerminalWifi", [callbackID,ssid, wifipassword, taskcount]);
		}
    };
    window.plus.esptouch = esptouch;
}, true );